﻿using System;
using System.Collections.Generic;
using System.Text;
using Newtonsoft.Json;

namespace Baidu.Push.Api
{
    public abstract class PushResponse
    {
        /// <summary>
        /// RequestId
        /// </summary>
        [JsonProperty("request_id")]
        public ulong RequestId { get; set; }

        /// <summary>
        /// 错误码
        /// </summary>
        [JsonProperty("error_code")]
        public int ErrorCode { get; set; }

        /// <summary>
        /// 错误信息
        /// </summary>
        [JsonProperty("error_msg")]
        public string ErrorMsg { get; set; }

        /// <summary>
        /// 响应原始内容
        /// </summary>
        public string Body { get; set; }

        /// <summary>
        /// HTTP GET请求的URL
        /// </summary>
        public string ReqUrl { get; set; }

        /// <summary>
        /// 响应结果是否错误
        /// </summary>
        public bool IsError
        {
            get
            {
                return this.ErrorCode != 0 || !string.IsNullOrEmpty(this.ErrorMsg);
            }
        }
    }
}
